package com.ruoyi.biz.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.biz.mapper.DormitoryBaseInfoMapper;
import com.ruoyi.biz.domain.DormitoryBaseInfo;
import com.ruoyi.biz.service.DormitoryBaseInfoService;

/**
 * 宿舍基础信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-09-02
 */
@Service
public class DormitoryBaseInfoServiceImpl implements DormitoryBaseInfoService {
    @Autowired
    private DormitoryBaseInfoMapper dormitoryBaseInfoMapper;

    /**
     * 查询宿舍基础信息
     *
     * @param dormitoryId 宿舍基础信息主键
     * @return 宿舍基础信息
     */
    @Override
    public DormitoryBaseInfo selectDormitoryBaseInfoByDormitoryId(Long dormitoryId) {
        return dormitoryBaseInfoMapper.selectDormitoryBaseInfoByDormitoryId(dormitoryId);
    }

    /**
     * 查询宿舍基础信息列表
     *
     * @param dormitoryBaseInfo 宿舍基础信息
     * @return 宿舍基础信息
     */
    @Override
    public List<DormitoryBaseInfo> selectDormitoryBaseInfoList(DormitoryBaseInfo dormitoryBaseInfo) {
        return dormitoryBaseInfoMapper.selectDormitoryBaseInfoList(dormitoryBaseInfo);
    }

    /**
     * 新增宿舍基础信息
     *
     * @param dormitoryBaseInfo 宿舍基础信息
     * @return 结果
     */
    @Override
    public int insertDormitoryBaseInfo(DormitoryBaseInfo dormitoryBaseInfo) {
        dormitoryBaseInfo.setCreateTime(DateUtils.getNowDate());
        return dormitoryBaseInfoMapper.insertDormitoryBaseInfo(dormitoryBaseInfo);
    }

    /**
     * 修改宿舍基础信息
     *
     * @param dormitoryBaseInfo 宿舍基础信息
     * @return 结果
     */
    @Override
    public int updateDormitoryBaseInfo(DormitoryBaseInfo dormitoryBaseInfo) {
        dormitoryBaseInfo.setUpdateTime(DateUtils.getNowDate());
        return dormitoryBaseInfoMapper.updateDormitoryBaseInfo(dormitoryBaseInfo);
    }

    /**
     * 批量删除宿舍基础信息
     *
     * @param dormitoryIds 需要删除的宿舍基础信息主键
     * @return 结果
     */
    @Override
    public int deleteDormitoryBaseInfoByDormitoryIds(Long[] dormitoryIds) {
        return dormitoryBaseInfoMapper.deleteDormitoryBaseInfoByDormitoryIds(dormitoryIds);
    }

    /**
     * 删除宿舍基础信息信息
     *
     * @param dormitoryId 宿舍基础信息主键
     * @return 结果
     */
    @Override
    public int deleteDormitoryBaseInfoByDormitoryId(Long dormitoryId) {
        return dormitoryBaseInfoMapper.deleteDormitoryBaseInfoByDormitoryId(dormitoryId);
    }
}
